Repository navigation
docs: event properties without jQuery, Template.instance() after await, flush timing, Web Components - #541
Open
dupontbertrand wants to merge 1 commit into
Open
docs: event properties without jQuery, Template.instance() after await, flush timing, Web Components#541dupontbertrand wants to merge 1 commit into
dupontbertrand wants to merge 1 commit into
Conversation
…ponents Four behaviours met while testing the MDN Web API index against Blaze 3.1 on both backends, stated nowhere in the docs: - without jQuery, `dataTransfer`, `deltaY`, `clipboardData`, `inputType` and similar are on `event` itself, `event.originalEvent` is undefined; - `Template.instance()` returns null after the first `await` of an async helper, callback or event handler; - the DOM is updated at flush time, so a View Transition callback must end with `Tracker.flush()` to animate anything. - a custom element that takes structured data through a property gets a string attribute from the template; set the property from an autorun in onRendered() instead.
This was referenced Nov 13, 2026
Open
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Four additions to the docs, coming out of a test pass of the browser APIs listed in the MDN Web API index (149 groups) against the head of
release-3.1.0, on both DOM backends, in a PWA. None of them is a Blaze bug: they are behaviours an app developer runs into and that the docs did not state.Changes
migrations.md, "Remove jQuery". jQuery does not copy properties such asdataTransfer,deltaY,clipboardData,inputType,animationName,newStateorcommandonto its event object, so with jQuery they were only reachable throughevent.originalEvent. With the native backend they are oneventitself andevent.originalEventisundefined. The breaking note now says so, with the form that works on both backends.api/templates.md,Template.instance(). In anasynchelper, callback or event handler,Template.instance()returnsnullafter the firstawait, because the current instance is only tracked for the synchronous part of the call. The entry now says to capture the instance first (second argument of event handlers,thisin callbacks), with an example.guide/understanding-blaze.md, new section "Flushing before the browser looks at the DOM". Blaze updates the DOM at flush time, not when a reactive value changes. APIs that expect the DOM to be updated when their callback returns, likedocument.startViewTransition(callback), see no change and animate nothing unless the callback ends withTracker.flush(). The section explains the timing and shows the pattern.guide/reusable-components.md, new section "Web Components". Custom elements render, upgrade and dispatch events as expected, but Blaze only writes attributes, which are strings, so a component that takes structured data through a JavaScript property cannot get it from the template. The section states this and shows the Blaze way: set the property from anautoruninonRendered(), which stays reactive. No change in the core: nobody asked for property binding in ten years and the pattern is three lines.Verification
Each behaviour was checked in the browser (Chrome 157 on Linux, Chrome 124 on Android) with the native and the jQuery backend, on an app built from
meteor create --pwa. Markdown only.npm run docs:build(VitePress) passes and the four pages render as expected; the mustache shown in prose uses<code v-pre>like the rest of the site.